/**
 * Created with IntelliJ IDEA.
 * Description:
 * User: yang
 * Date: 2022-05-26
 * Time: 21:01
 */
class A{}
class B extends A{}
class Test extends B{
    int a;
    Test(int a){
        this.a = a;
    }

    @Override
    public boolean equals(Object o){
        if(o instanceof Test == false){
            return false;
        }
        Test tmp = (Test) o;
        return a == tmp.a;
    }
//    public boolean equals(Object o) {
//        if(this.getClass() != o.getClass()){
//            return false;
//        }
//        Test tmp = (Test) o;
//        return a == tmp.a;
//    }
}

class Employee{
    int id;
    public String name;

    public Employee(int id,String name) {
        this.id = id;
        this.name = name;
    }

    @Override
    public final boolean equals(Object o){
        if(this == o){
            return true;
        }

        if(o == null){
            return false;
        }

        if(o instanceof Employee){
            return false;
        }
        Employee tmp = (Employee) o;
        return this.name == tmp.name && this.id == tmp.id;
    }
}

class Manager extends Employee{
    public double bonus;

    public Manager(int id,String name, double bonus) {
        super(id,name);
        this.bonus = bonus;
    }


}
public class Main {
    public static void main(String[] args) {
        Employee employee = new Employee(1,"jack");
        Employee manager = new Manager(1,"jack",500);
        System.out.println(employee.equals(manager));
        System.out.println(manager.equals(employee));
    }
}
